package itheima.com.d07;

public class Test {

    public static void swim(ISwimming swim) {
        System.out.println("开始游...");
        swim.swim();
        System.out.println("结束游...");
    }

    public static void main(String[] args) {
        ISwimming pig = new ISwimming() {
            @Override
            public void swim() {
                System.out.println("猪游...");
            }
        };
        swim(new ISwimming() {
            @Override
            public void swim() {
                System.out.println("狗游...");
            }
        });
        swim(new ISwimming() {
            @Override
            public void swim() {
                System.out.println("猫游...");

            }
        });

    }
}
